[C# .NET6] AutoFac ADD implementation after DI Container Resolve


If you want to Add a implementation after DI Container resolved already,
you need to create a newBuilder and Update it to the original Container.

                var newBuilder = new ContainerBuilder();
                newBuilder.Register(c =>  new Car {Seats = GetSeats().Split(',') }).As<ICar>();
                newBuilder.Update(OriginalDIContainer);
#C# #.net6 #.net






你可能感興趣的文章

MTR04_0927

MTR04_0927

物件導向--基於類別與原型的範例

物件導向--基於類別與原型的範例

2023 D4SG 成果發表會心得

2023 D4SG 成果發表會心得






留言討論